package ArrayList;

/**
 * @Classname JZ53n_1中缺失的数字
 * @Description TODO
 * @Date 2022/12/8 14:56
 * @Created by xjl
 */
public class JZ53n_1中缺失的数字 {

    public int missingNumber(int[] nums) {
        int i = 0;
        int j = nums.length - 1;
        while (i <= j) {
            int m = (i + j) >> 1;
            if (nums[m] == m) {
                i = m + 1;
            } else {
                j = m - 1;
            }
        }
        return i;
    }
}
